//
//  BBMyApplyViewController.m
//  1111
//
//  Created by BearBaby on 16/3/25.
//  Copyright © 2016年 BearBaby. All rights reserved.
//

#import "BBMyApplyViewController.h"
#import "BBMyApplyTableViewCell.h"
#import "BBMyApplyDetailController.h"
#import "BBApplyTypeViewController.h"
@interface BBMyApplyViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView* tableView;
@property(nonatomic,strong)BBMyApplyDetailController* detailVC;      //申请流程详情
@end

@implementation BBMyApplyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我的申请流程";
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WINSIZEWIDTH, WINSIZEHEIGHT) style:UITableViewStyleGrouped];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    
     self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"我要申请" style:UIBarButtonItemStylePlain target:self action:@selector(apply:)];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return 3;

}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString* identifire = @"Cell";
    BBMyApplyTableViewCell* cell = [self.tableView dequeueReusableCellWithIdentifier:identifire];
    if (!cell) {
        cell = [[BBMyApplyTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifire];
        cell.delegate = self;
    }
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    self.detailVC = [[BBMyApplyDetailController alloc]init];
    [self.navigationController pushViewController:self.detailVC animated:YES];

}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.0000001;

}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{

    return 15;

}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    CGFloat cellHeight = 0.0f;
    BBMyApplyTableViewCell *cell = (BBMyApplyTableViewCell *)[self tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath];
    cellHeight = cell.finalH;
    return cellHeight;
}
-(void)apply:(UIBarButtonItem*)item{
    BBApplyTypeViewController* typeVC = [[BBApplyTypeViewController alloc]init];

    [self.navigationController pushViewController:typeVC animated:YES];

}
@end
